package com.gzist.elderlyserviceplatform.controller.client;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gzist.elderlyserviceplatform.common.Result;
import com.gzist.elderlyserviceplatform.common.base.BaseDTO;
import com.gzist.elderlyserviceplatform.entity.dto.ServiceReservationDTO;
import com.gzist.elderlyserviceplatform.entity.po.ElderlyService;
import com.gzist.elderlyserviceplatform.service.ElderlyServiceService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * 养老服务表
 */
@RestController
@Tag(name = "养老服务管理")
@RequestMapping("/api/client/elderlyService")
@RequiredArgsConstructor
public class ElderlyServiceControllerC {

    private final ElderlyServiceService elderlyServiceService;

    /**
     * 获取养老院信息
     */
    @PostMapping("/getElderlyService")
    @Operation(summary = "获取养老院信息")
    public Result<Page<ElderlyService>> queryElderlyServiceList(
            @RequestBody
            @Parameter(description = "分页参数") BaseDTO baseDto
    ) {
        return Result.success(elderlyServiceService.queryPage(baseDto), "查询成功");
    }

    /**
     * 养老服务预约
     */
    @PostMapping("/addElderlyService")
    @Operation(summary = "养老服务预约")
    public Result<Object> addElderlyService(
            @RequestBody
            @Parameter(description = "预约表单信息") ServiceReservationDTO serviceReservationDTO
    ) {
        elderlyServiceService.serviceReservation(serviceReservationDTO);
        return Result.success("预约成功");
    }
}